package com.mzwf.cloud;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.cloud.netflix.zuul.filters.discovery.PatternServiceRouteMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * 本项目中关于RxJava 不懂，需要以后学习
 */
@SpringBootApplication
@EnableZuulProxy //声明zuul代理
public class ZuulAggregationApplication {
	/**在使用springcloud ribbon客户端负载均衡的时候，
	 * 可以给RestTemplate bean 加一个@LoadBalanced注解，
	 * 就能让这个RestTemplate在请求时拥有客户端负载均衡的能力
	 * @return
	 */
	@LoadBalanced
	@Bean
    public RestTemplate restTemplate(){
    	return new RestTemplate();
	}
	public static void main(String[] args) {
		SpringApplication.run(ZuulAggregationApplication.class, args);
	}
}
